Copy file from one folder to another

Hi,

I am using below code to copy a file from one folder to another from DXL

string DirPath = "c:\\\\Archana/"
string nameOfMacro = "My_Macro.docm"
string nameOfFile = "c:\\\\Archana/My_Macro.docm"
 
string SRSSection    = get(dbe_SECTION_NAME)
string DirName = DirPath "s" SRSSection
 
mkdir(DirName)
 
OleAutoObj wDocs1 = null, wDoc1 = null
OleAutoObj wApp1 = oleCreateAutoObject("Word.Application")
olePut(wApp1, "Visible", "true")
oleGet(wApp1, \"Documents\", wDoc1)
 
OleAutoArgs macroArgs = create()
put(macroArgs, nameOfFile)
oleMethod(wDoc1, "Open", macroArgs)
 
put(macroArgs, DirPath "s" SRSSection nameOfMacro)
oleMethod(wDoc1, "SaveAs", macroArgs)

It doesnt give error but doesnt copy.

Any suggestions?

Thanks

Chitra


ChitraUTAS - Tue Oct 31 06:59:09 EDT 2017

Re: Copy file from one folder to another
PekkaMakinen - Tue Oct 31 07:03:16 EDT 2017

To copy a file there is a direct DXL function

 

copyFile 
Declaration 
string copyFile(string sourceFileName,
                 string destFileName) 
Operation 
Copies file sourceFileName to destFileName. If the operation succeeds, returns null; otherwise, returns an error message. 

Example 
copyFile("file1", "file2")